home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / initCommandLine.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  5.0 KB  |  156 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:  Aug 15 1996
  22. //
  23. //  Description:
  24. //      This script initializes the Command line.  Initialization involves
  25. //        determining the initial Command line preferences, creating the UI
  26. //        and setting the initial visibility.
  27. //
  28. {
  29.     //   Declare referenced or returned globals.
  30.     //
  31.     global string $gCommandWindow;
  32.     global string $gCommandLineForm;
  33.     global string $gCommandLine;
  34.  
  35.     //  Create a layout appropriate for the Command line.
  36.     // 
  37.     string $commandLineForm = `formLayout -parent $gCommandLineForm`;
  38.     
  39.     //    Now actually create the Command line.  
  40.     //
  41.     // MAYAMACTODO - This is a temporary fix to make the command line's 
  42.     // visibility a bit more. There seems to be some layout problem else where.
  43.      
  44.     if(`about -mac`){
  45.         $gCommandLine = `commandLine
  46.         -height 30
  47.         -enterCommand "setFocus $gCommandLine"
  48.         -inputAnnotation "Command Line: Enter MEL commands"
  49.         -outputAnnotation "Command Feedback: Displays the command response (Open Script Editor to display more of the history)"`;
  50.         
  51.     }else{
  52.         $gCommandLine = `commandLine
  53.             -enterCommand "setFocus $gCommandLine"
  54.             -inputAnnotation "Command Line: Enter MEL commands"
  55.             -outputAnnotation "Command Feedback: Displays the command response (Open Script Editor to display more of the history)"`;
  56.     }
  57.  
  58.     if(`optionVar -exists commandLineInputFieldWidth`)
  59.         paneLayout -e -ps 1 `optionVar -q commandLineInputFieldWidth` 100 $gCommandLine;
  60.  
  61.     if(`optionVar -exists commandLineNumHistoryLines`)
  62.         commandLine -e -numberOfHistoryLines `optionVar -q commandLineNumHistoryLines` $gCommandLine;
  63.  
  64.     //    If the hold focus preference is not set then attach a 
  65.     //    command to send focus back to the view panes.
  66.     //
  67.     int $holdFocus = `optionVar -query commandLineHoldFocus`;
  68.     if (!$holdFocus) {
  69.         commandLine -edit 
  70.             -command "setFocus `paneLayout -query -pane1 viewPanes`"
  71.             $gCommandLine;
  72.     }
  73.  
  74.     //    The "show the Command window" button.
  75.     //
  76.     string $iconButton = `symbolButton 
  77.         -image      "cmdWndIcon.xpm" 
  78.         -annotation "Script Editor"
  79.         -command    "showWindow $gCommandWindow"`;
  80.     
  81.     //    For improving the alignment of the button.
  82.     //
  83.     int $topSpacing, $bottomSpacing;
  84.     if (`about -nt`) {
  85.         $topSpacing = 1;
  86.         $bottomSpacing = 1;
  87.     } else if(`about -mac`) {
  88.         $topSpacing = 1;
  89.         $bottomSpacing = 8;    
  90.     } else {
  91.         $topSpacing = 0;
  92.         $bottomSpacing = 1;
  93.     }
  94.  
  95.     //    Layout Command line contents.
  96.     // 
  97.     formLayout -edit
  98.         -attachForm    $gCommandLine "top"    0
  99.         -attachForm    $gCommandLine "left"   0
  100.         -attachForm    $gCommandLine "bottom" 0
  101.         -attachControl $gCommandLine "right"  0 $iconButton
  102.  
  103.         -attachForm    $iconButton   "top"    $topSpacing
  104.         -attachNone    $iconButton   "left"
  105.         -attachForm    $iconButton   "bottom" $bottomSpacing
  106.         -attachForm    $iconButton   "right"  0
  107.         $commandLineForm;
  108.  
  109.     //    Attach Command line to parent.
  110.     //
  111.     formLayout -edit
  112.         -attachForm $commandLineForm "top"    0
  113.         -attachForm $commandLineForm "left"   0
  114.         -attachForm $commandLineForm "bottom" 0
  115.         -attachForm $commandLineForm "right"  0
  116.         $gCommandLineForm;
  117.  
  118.     setUIComponentStateCallback(
  119.         "Command Line", "commandLineVisibilityStateChange");
  120.         
  121.     //    Set the Command line's initial visibility.
  122.     //
  123.     setCommandLineVisible(`optionVar -query commandLineVisible`);
  124. }
  125.  
  126. global proc int commandLineVisibilityStateChange(
  127.     int    $newState,
  128.     string $layout)
  129. //
  130. //    Description:
  131. //        This procedure is called whenever the visibility state of the 
  132. //        Command Line is changed.
  133. //
  134. //    Arguments:
  135. //        newState - The new visibile state of the Command Line.
  136. //
  137. //        layout - The parent layout for the Command Line.
  138. //
  139. //    Returns:
  140. //        true - If the change of state is to be allowed.
  141. //
  142. //        false - If the state change is rejected.
  143. //
  144. {
  145.     int $result = true;
  146.  
  147.     //    Defer these commands because this proc is called when the visibility
  148.     //    state is about to change. This proc must return true to accept 
  149.     //    the state change. After this proc returns then restore the
  150.     //    panel focus and update the pref menu.
  151.     //
  152.     evalDeferred("restoreLastPanelWithFocus(); updatePrefsMenu();");
  153.  
  154.     return $result;
  155. }
  156.